home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / AIncludes / Memory.a < prev    next >
Text File  |  1996-05-01  |  25KB  |  1,325 lines

  1. ;
  2. ;    File:        Memory.a
  3. ;
  4. ;    Contains:    Memory Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Release:    Universal Interfaces 3.0d3 on Copland DR1
  8. ;
  9. ;    Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10. ;
  11. ;    Bugs?:        If you find a problem with this file, send the file and version
  12. ;                information (from above) and the problem description to:
  13. ;
  14. ;                    Internet:    apple.bugs@applelink.apple.com
  15. ;                    AppleLink:    APPLE.BUGS
  16. ;
  17. ;
  18. ;
  19. ; NOTE
  20. ;
  21. ; Don't change GetHandleSize and GetPtrSize into inlines.  They are documented as returning
  22. ; 0 in case of an error in Inside Mac, but the traps actually return an error code in D0.
  23. ; The glue sets D0 to 0 if an error occured.
  24. ;
  25.     IF &TYPE('__MEMORY__') = 'UNDEFINED' THEN
  26. __MEMORY__ SET 1
  27.  
  28.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  29.     include 'Types.a'
  30.     ENDIF
  31.     IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
  32.     include 'MixedMode.a'
  33.     ENDIF
  34.  
  35. maxSize                            EQU        $00800000            ;Max data block size is 8 megabytes
  36. defaultPhysicalEntryCount        EQU        8                    ; values returned from the GetPageState function 
  37. kPageInMemory                    EQU        0
  38. kPageOnDisk                        EQU        1
  39. kNotPaged                        EQU        2
  40.  
  41.                                                             ; masks for Zone->heapType field 
  42. k32BitHeap                        EQU        1                    ; valid in all Memory Managers 
  43. kNewStyleHeap                    EQU        2                    ; true if new Heap Manager is present 
  44. kNewDebugHeap                    EQU        4                    ; true if new Heap Manager is running in debug mode on this heap 
  45. ;  size of a block in bytes 
  46. ; typedef long                             Size
  47.  
  48.     IF FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE THEN
  49. Zone                    RECORD 0
  50. bkLim                     ds.l    1                ; offset: $0 (0)
  51. purgePtr                 ds.l    1                ; offset: $4 (4)
  52. hFstFree                 ds.l    1                ; offset: $8 (8)
  53. zcbFree                     ds.l    1                ; offset: $C (12)
  54. gzProc                     ds.l    1                ; offset: $10 (16)
  55. moreMast                 ds.w    1                ; offset: $14 (20)
  56. flags                     ds.w    1                ; offset: $16 (22)
  57. cntRel                     ds.w    1                ; offset: $18 (24)
  58. maxRel                     ds.w    1                ; offset: $1A (26)
  59. cntNRel                     ds.w    1                ; offset: $1C (28)
  60. heapType                 ds.b    1                ; offset: $1E (30)        ;  previously "maxNRel", now holds flags (e.g. k32BitHeap)
  61. unused                     ds.b    1                ; offset: $1F (31)
  62. cntEmpty                 ds.w    1                ; offset: $20 (32)
  63. cntHandles                 ds.w    1                ; offset: $22 (34)
  64. minCBFree                 ds.l    1                ; offset: $24 (36)
  65. purgeProc                 ds.l    1                ; offset: $28 (40)
  66. sparePtr                 ds.l    1                ; offset: $2C (44)
  67. allocPtr                 ds.l    1                ; offset: $30 (48)
  68. heapData                 ds.w    1                ; offset: $34 (52)
  69. sizeof                     EQU *                    ; size:   $36 (54)
  70.                         ENDR
  71. ; typedef struct Zone *                    THz
  72.  
  73. MemoryBlock                RECORD 0
  74. address                     ds.l    1                ; offset: $0 (0)
  75. count                     ds.l    1                ; offset: $4 (4)
  76. sizeof                     EQU *                    ; size:   $8 (8)
  77.                         ENDR
  78. LogicalToPhysicalTable    RECORD 0
  79. logical                     ds        MemoryBlock        ; offset: $0 (0)
  80. physical                 ds.b    8 * MemoryBlock.sizeof ; offset: $8 (8)
  81. sizeof                     EQU *                    ; size:   $48 (72)
  82.                         ENDR
  83. ; typedef short                         PageState
  84.  
  85. ; typedef short                         StatusRegisterContents
  86.  
  87. ;
  88. ; pascal Ptr GetApplLimit(void)
  89. ;
  90.     IF ¨ GENERATINGCFM THEN
  91.         Macro
  92.         _GetApplLimit         &dest=(sp)
  93.             move.l            $0130,&dest
  94.         EndM
  95.     ELSE
  96.         IMPORT_CFM_FUNCTION GetApplLimit
  97.     ENDIF
  98.  
  99. ;
  100. ; pascal THz SystemZone(void)
  101. ;
  102.     IF ¨ GENERATINGCFM THEN
  103.         Macro
  104.         _SystemZone           &dest=(sp)
  105.             move.l            $02A6,&dest
  106.         EndM
  107.     ELSE
  108.         IMPORT_CFM_FUNCTION SystemZone
  109.     ENDIF
  110.  
  111. ;
  112. ; pascal THz ApplicationZone(void)
  113. ;
  114.     IF ¨ GENERATINGCFM THEN
  115.         Macro
  116.         _ApplicationZone      &dest=(sp)
  117.             move.l            $02AA,&dest
  118.         EndM
  119.     ELSE
  120.         IMPORT_CFM_FUNCTION ApplicationZone
  121.     ENDIF
  122.  
  123. ;
  124. ; pascal Handle GZSaveHnd(void)
  125. ;
  126.     IF ¨ GENERATINGCFM THEN
  127.         Macro
  128.         _GZSaveHnd            &dest=(sp)
  129.             move.l            $0328,&dest
  130.         EndM
  131.     ELSE
  132.         IMPORT_CFM_FUNCTION GZSaveHnd
  133.     ENDIF
  134.  
  135. ;
  136. ; pascal Ptr TopMem(void)
  137. ;
  138.     IF ¨ GENERATINGCFM THEN
  139.         Macro
  140.         _TopMem               &dest=(sp)
  141.             move.l            $0108,&dest
  142.         EndM
  143.     ELSE
  144.         IMPORT_CFM_FUNCTION TopMem
  145.     ENDIF
  146.  
  147. ;
  148. ; pascal OSErr MemError(void)
  149. ;
  150.     IF ¨ GENERATINGCFM THEN
  151.         Macro
  152.         _MemError             &dest=(sp)
  153.             move.w            $0220,&dest
  154.         EndM
  155.     ELSE
  156.         IMPORT_CFM_FUNCTION MemError
  157.     ENDIF
  158.  
  159.     ENDIF
  160.     IF FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE THEN
  161. ;
  162. ; pascal THz GetZone(void )
  163. ;
  164.     IF ¨ GENERATINGCFM THEN
  165.         ; returns:
  166.         ;    THz             <= A0
  167.         _GetZone:    OPWORD    $A11A
  168.     ELSE
  169.         IMPORT_CFM_FUNCTION GetZone
  170.     ENDIF
  171.  
  172. ;
  173. ; pascal Handle NewHandle(Size byteCount)
  174. ;
  175.     IF ¨ GENERATINGCFM THEN
  176.         ; parameters:
  177.         ;    byteCount       => D0
  178.         ; returns:
  179.         ;    Handle          <= A0
  180.         _NewHandle:    OPWORD    $A122
  181.     ELSE
  182.         IMPORT_CFM_FUNCTION NewHandle
  183.     ENDIF
  184.  
  185. ;
  186. ; pascal Handle NewHandleSys(Size byteCount)
  187. ;
  188.     IF ¨ GENERATINGCFM THEN
  189.         ; parameters:
  190.         ;    byteCount       => D0
  191.         ; returns:
  192.         ;    Handle          <= A0
  193.         _NewHandleSys:    OPWORD    $A522
  194.     ELSE
  195.         IMPORT_CFM_FUNCTION NewHandleSys
  196.     ENDIF
  197.  
  198. ;
  199. ; pascal Handle NewHandleClear(Size byteCount)
  200. ;
  201.     IF ¨ GENERATINGCFM THEN
  202.         ; parameters:
  203.         ;    byteCount       => D0
  204.         ; returns:
  205.         ;    Handle          <= A0
  206.         _NewHandleClear:    OPWORD    $A322
  207.     ELSE
  208.         IMPORT_CFM_FUNCTION NewHandleClear
  209.     ENDIF
  210.  
  211. ;
  212. ; pascal Handle NewHandleSysClear(Size byteCount)
  213. ;
  214.     IF ¨ GENERATINGCFM THEN
  215.         ; parameters:
  216.         ;    byteCount       => D0
  217.         ; returns:
  218.         ;    Handle          <= A0
  219.         _NewHandleSysClear:    OPWORD    $A722
  220.     ELSE
  221.         IMPORT_CFM_FUNCTION NewHandleSysClear
  222.     ENDIF
  223.  
  224. ;
  225. ; pascal THz HandleZone(Handle h)
  226. ;
  227.     IF ¨ GENERATINGCFM THEN
  228.         ; parameters:
  229.         ;    h               => A0
  230.         ; returns:
  231.         ;    THz             <= A0
  232.         _HandleZone:    OPWORD    $A126
  233.     ELSE
  234.         IMPORT_CFM_FUNCTION HandleZone
  235.     ENDIF
  236.  
  237. ;
  238. ; pascal Handle RecoverHandle(Ptr p)
  239. ;
  240.     IF ¨ GENERATINGCFM THEN
  241.         ; parameters:
  242.         ;    p               => A0
  243.         ; returns:
  244.         ;    Handle          <= A0
  245.         _RecoverHandle:    OPWORD    $A128
  246.     ELSE
  247.         IMPORT_CFM_FUNCTION RecoverHandle
  248.     ENDIF
  249.  
  250. ;
  251. ; pascal Handle RecoverHandleSys(Ptr p)
  252. ;
  253.     IF ¨ GENERATINGCFM THEN
  254.         ; parameters:
  255.         ;    p               => A0
  256.         ; returns:
  257.         ;    Handle          <= A0
  258.         _RecoverHandleSys:    OPWORD    $A528
  259.     ELSE
  260.         IMPORT_CFM_FUNCTION RecoverHandleSys
  261.     ENDIF
  262.  
  263. ;
  264. ; pascal Ptr NewPtr(Size byteCount)
  265. ;
  266.     IF ¨ GENERATINGCFM THEN
  267.         ; parameters:
  268.         ;    byteCount       => D0
  269.         ; returns:
  270.         ;    Ptr             <= A0
  271.         _NewPtr:    OPWORD    $A11E
  272.     ELSE
  273.         IMPORT_CFM_FUNCTION NewPtr
  274.     ENDIF
  275.  
  276. ;
  277. ; pascal Ptr NewPtrSys(Size byteCount)
  278. ;
  279.     IF ¨ GENERATINGCFM THEN
  280.         ; parameters:
  281.         ;    byteCount       => D0
  282.         ; returns:
  283.         ;    Ptr             <= A0
  284.         _NewPtrSys:    OPWORD    $A51E
  285.     ELSE
  286.         IMPORT_CFM_FUNCTION NewPtrSys
  287.     ENDIF
  288.  
  289. ;
  290. ; pascal Ptr NewPtrClear(Size byteCount)
  291. ;
  292.     IF ¨ GENERATINGCFM THEN
  293.         ; parameters:
  294.         ;    byteCount       => D0
  295.         ; returns:
  296.         ;    Ptr             <= A0
  297.         _NewPtrClear:    OPWORD    $A31E
  298.     ELSE
  299.         IMPORT_CFM_FUNCTION NewPtrClear
  300.     ENDIF
  301.  
  302. ;
  303. ; pascal Ptr NewPtrSysClear(Size byteCount)
  304. ;
  305.     IF ¨ GENERATINGCFM THEN
  306.         ; parameters:
  307.         ;    byteCount       => D0
  308.         ; returns:
  309.         ;    Ptr             <= A0
  310.         _NewPtrSysClear:    OPWORD    $A71E
  311.     ELSE
  312.         IMPORT_CFM_FUNCTION NewPtrSysClear
  313.     ENDIF
  314.  
  315. ;
  316. ; pascal THz PtrZone(Ptr p)
  317. ;
  318.     IF ¨ GENERATINGCFM THEN
  319.         ; parameters:
  320.         ;    p               => A0
  321.         ; returns:
  322.         ;    THz             <= A0
  323.         _PtrZone:    OPWORD    $A148
  324.     ELSE
  325.         IMPORT_CFM_FUNCTION PtrZone
  326.     ENDIF
  327.  
  328. ;
  329. ; pascal long MaxBlock(void )
  330. ;
  331.     IF ¨ GENERATINGCFM THEN
  332.         ; returns:
  333.         ;    long            <= D0
  334.         _MaxBlock:    OPWORD    $A061
  335.     ELSE
  336.         IMPORT_CFM_FUNCTION MaxBlock
  337.     ENDIF
  338.  
  339. ;
  340. ; pascal long MaxBlockSys(void )
  341. ;
  342.     IF ¨ GENERATINGCFM THEN
  343.         ; returns:
  344.         ;    long            <= D0
  345.         _MaxBlockSys:    OPWORD    $A461
  346.     ELSE
  347.         IMPORT_CFM_FUNCTION MaxBlockSys
  348.     ENDIF
  349.  
  350. ;
  351. ; pascal long StackSpace(void )
  352. ;
  353.     IF ¨ GENERATINGCFM THEN
  354.         ; returns:
  355.         ;    long            <= D0
  356.         _StackSpace:    OPWORD    $A065
  357.     ELSE
  358.         IMPORT_CFM_FUNCTION StackSpace
  359.     ENDIF
  360.  
  361. ;
  362. ; pascal Handle NewEmptyHandle(void )
  363. ;
  364.     IF ¨ GENERATINGCFM THEN
  365.         ; returns:
  366.         ;    Handle          <= A0
  367.         _NewEmptyHandle:    OPWORD    $A166
  368.     ELSE
  369.         IMPORT_CFM_FUNCTION NewEmptyHandle
  370.     ENDIF
  371.  
  372. ;
  373. ; pascal Handle NewEmptyHandleSys(void )
  374. ;
  375.     IF ¨ GENERATINGCFM THEN
  376.         ; returns:
  377.         ;    Handle          <= A0
  378.         _NewEmptyHandleSys:    OPWORD    $A566
  379.     ELSE
  380.         IMPORT_CFM_FUNCTION NewEmptyHandleSys
  381.     ENDIF
  382.  
  383. ;
  384. ; pascal void HLock(Handle h)
  385. ;
  386.     IF ¨ GENERATINGCFM THEN
  387.         ; parameters:
  388.         ;    h               => A0
  389.         _HLock:    OPWORD    $A029
  390.     ELSE
  391.         IMPORT_CFM_FUNCTION HLock
  392.     ENDIF
  393.  
  394. ;
  395. ; pascal void HUnlock(Handle h)
  396. ;
  397.     IF ¨ GENERATINGCFM THEN
  398.         ; parameters:
  399.         ;    h               => A0
  400.         _HUnlock:    OPWORD    $A02A
  401.     ELSE
  402.         IMPORT_CFM_FUNCTION HUnlock
  403.     ENDIF
  404.  
  405. ;
  406. ; pascal void HPurge(Handle h)
  407. ;
  408.     IF ¨ GENERATINGCFM THEN
  409.         ; parameters:
  410.         ;    h               => A0
  411.         _HPurge:    OPWORD    $A049
  412.     ELSE
  413.         IMPORT_CFM_FUNCTION HPurge
  414.     ENDIF
  415.  
  416. ;
  417. ; pascal void HNoPurge(Handle h)
  418. ;
  419.     IF ¨ GENERATINGCFM THEN
  420.         ; parameters:
  421.         ;    h               => A0
  422.         _HNoPurge:    OPWORD    $A04A
  423.     ELSE
  424.         IMPORT_CFM_FUNCTION HNoPurge
  425.     ENDIF
  426.  
  427. ;
  428. ; pascal void HLockHi(Handle h)
  429. ;
  430.     IF ¨ GENERATINGCFM THEN
  431.         ; parameters:
  432.         ;    h               => A0
  433.         Macro
  434.         _HLockHi
  435.             dc.w                $A064
  436.             dc.w                $A029
  437.         EndM
  438.     ELSE
  439.         IMPORT_CFM_FUNCTION HLockHi
  440.     ENDIF
  441.  
  442. ;
  443. ; pascal Handle TempNewHandle(Size logicalSize, OSErr *resultCode)
  444. ;
  445.     IF ¨ GENERATINGCFM THEN
  446.         Macro
  447.         _TempNewHandle
  448.             move.w              #$001D,-(sp)
  449.             dc.w                $A88F
  450.         EndM
  451.     ELSE
  452.         IMPORT_CFM_FUNCTION TempNewHandle
  453.     ENDIF
  454.  
  455. ;
  456. ; pascal Size TempMaxMem(Size *grow)
  457. ;
  458.     IF ¨ GENERATINGCFM THEN
  459.         Macro
  460.         _TempMaxMem
  461.             move.w              #$0015,-(sp)
  462.             dc.w                $A88F
  463.         EndM
  464.     ELSE
  465.         IMPORT_CFM_FUNCTION TempMaxMem
  466.     ENDIF
  467.  
  468. ;
  469. ; pascal long TempFreeMem(void )
  470. ;
  471.     IF ¨ GENERATINGCFM THEN
  472.         Macro
  473.         _TempFreeMem
  474.             move.w              #$0018,-(sp)
  475.             dc.w                $A88F
  476.         EndM
  477.     ELSE
  478.         IMPORT_CFM_FUNCTION TempFreeMem
  479.     ENDIF
  480.  
  481. ;
  482. ; pascal void InitZone(GrowZoneUPP pgrowZone, short cmoreMasters, void *limitPtr, void *startPtr)
  483. ;
  484.     IF ¨ GENERATINGCFM THEN
  485.         _InitZone:    OPWORD    $A019
  486.     ELSE
  487.         IMPORT_CFM_FUNCTION InitZone
  488.     ENDIF
  489.  
  490. ;
  491. ; pascal void SetZone(THz hz)
  492. ;
  493.     IF ¨ GENERATINGCFM THEN
  494.         ; parameters:
  495.         ;    hz              => A0
  496.         _SetZone:    OPWORD    $A01B
  497.     ELSE
  498.         IMPORT_CFM_FUNCTION SetZone
  499.     ENDIF
  500.  
  501. ;
  502. ; pascal Size CompactMem(Size cbNeeded)
  503. ;
  504.     IF ¨ GENERATINGCFM THEN
  505.         ; parameters:
  506.         ;    cbNeeded        => D0
  507.         ; returns:
  508.         ;    Size            <= D0
  509.         _CompactMem:    OPWORD    $A04C
  510.     ELSE
  511.         IMPORT_CFM_FUNCTION CompactMem
  512.     ENDIF
  513.  
  514. ;
  515. ; pascal Size CompactMemSys(Size cbNeeded)
  516. ;
  517.     IF ¨ GENERATINGCFM THEN
  518.         ; parameters:
  519.         ;    cbNeeded        => D0
  520.         ; returns:
  521.         ;    Size            <= D0
  522.         _CompactMemSys:    OPWORD    $A44C
  523.     ELSE
  524.         IMPORT_CFM_FUNCTION CompactMemSys
  525.     ENDIF
  526.  
  527. ;
  528. ; pascal void PurgeMem(Size cbNeeded)
  529. ;
  530.     IF ¨ GENERATINGCFM THEN
  531.         ; parameters:
  532.         ;    cbNeeded        => D0
  533.         _PurgeMem:    OPWORD    $A04D
  534.     ELSE
  535.         IMPORT_CFM_FUNCTION PurgeMem
  536.     ENDIF
  537.  
  538. ;
  539. ; pascal void PurgeMemSys(Size cbNeeded)
  540. ;
  541.     IF ¨ GENERATINGCFM THEN
  542.         ; parameters:
  543.         ;    cbNeeded        => D0
  544.         _PurgeMemSys:    OPWORD    $A44D
  545.     ELSE
  546.         IMPORT_CFM_FUNCTION PurgeMemSys
  547.     ENDIF
  548.  
  549. ;
  550. ; pascal long FreeMem(void )
  551. ;
  552.     IF ¨ GENERATINGCFM THEN
  553.         ; returns:
  554.         ;    long            <= D0
  555.         _FreeMem:    OPWORD    $A01C
  556.     ELSE
  557.         IMPORT_CFM_FUNCTION FreeMem
  558.     ENDIF
  559.  
  560. ;
  561. ; pascal long FreeMemSys(void )
  562. ;
  563.     IF ¨ GENERATINGCFM THEN
  564.         ; returns:
  565.         ;    long            <= D0
  566.         _FreeMemSys:    OPWORD    $A41C
  567.     ELSE
  568.         IMPORT_CFM_FUNCTION FreeMemSys
  569.     ENDIF
  570.  
  571. ;
  572. ; pascal void ReserveMem(Size cbNeeded)
  573. ;
  574.     IF ¨ GENERATINGCFM THEN
  575.         ; parameters:
  576.         ;    cbNeeded        => D0
  577.         _ReserveMem:    OPWORD    $A040
  578.     ELSE
  579.         IMPORT_CFM_FUNCTION ReserveMem
  580.     ENDIF
  581.  
  582. ;
  583. ; pascal void ReserveMemSys(Size cbNeeded)
  584. ;
  585.     IF ¨ GENERATINGCFM THEN
  586.         ; parameters:
  587.         ;    cbNeeded        => D0
  588.         _ReserveMemSys:    OPWORD    $A440
  589.     ELSE
  590.         IMPORT_CFM_FUNCTION ReserveMemSys
  591.     ENDIF
  592.  
  593. ;
  594. ; pascal Size MaxMem(Size *grow)
  595. ;
  596.     IF ¨ GENERATINGCFM THEN
  597.         _MaxMem:    OPWORD    $A11D
  598.     ELSE
  599.         IMPORT_CFM_FUNCTION MaxMem
  600.     ENDIF
  601.  
  602. ;
  603. ; pascal Size MaxMemSys(Size *grow)
  604. ;
  605.     IF ¨ GENERATINGCFM THEN
  606.         _MaxMemSys:    OPWORD    $A51D
  607.     ELSE
  608.         IMPORT_CFM_FUNCTION MaxMemSys
  609.     ENDIF
  610.  
  611. ;
  612. ; pascal void SetGrowZone(GrowZoneUPP growZone)
  613. ;
  614.     IF ¨ GENERATINGCFM THEN
  615.         ; parameters:
  616.         ;    growZone        => A0
  617.         _SetGrowZone:    OPWORD    $A04B
  618.     ELSE
  619.         IMPORT_CFM_FUNCTION SetGrowZone
  620.     ENDIF
  621.  
  622. ;
  623. ; pascal void MoveHHi(Handle h)
  624. ;
  625.     IF ¨ GENERATINGCFM THEN
  626.         ; parameters:
  627.         ;    h               => A0
  628.         _MoveHHi:    OPWORD    $A064
  629.     ELSE
  630.         IMPORT_CFM_FUNCTION MoveHHi
  631.     ENDIF
  632.  
  633. ;
  634. ; pascal void DisposePtr(Ptr p)
  635. ;
  636.     IF ¨ GENERATINGCFM THEN
  637.         ; parameters:
  638.         ;    p               => A0
  639.         _DisposePtr:    OPWORD    $A01F
  640.     ELSE
  641.         IMPORT_CFM_FUNCTION DisposePtr
  642.     ENDIF
  643.  
  644. ;
  645. ; pascal Size GetPtrSize(Ptr p)
  646. ;
  647.     IF ¨ GENERATINGCFM THEN
  648.         _GetPtrSize:    OPWORD    $A021
  649.     ELSE
  650.         IMPORT_CFM_FUNCTION GetPtrSize
  651.     ENDIF
  652.  
  653. ;
  654. ; pascal void SetPtrSize(Ptr p, Size newSize)
  655. ;
  656.     IF ¨ GENERATINGCFM THEN
  657.         ; parameters:
  658.         ;    p               => A0
  659.         ;    newSize         => D0
  660.         _SetPtrSize:    OPWORD    $A020
  661.     ELSE
  662.         IMPORT_CFM_FUNCTION SetPtrSize
  663.     ENDIF
  664.  
  665. ;
  666. ; pascal void DisposeHandle(Handle h)
  667. ;
  668.     IF ¨ GENERATINGCFM THEN
  669.         ; parameters:
  670.         ;    h               => A0
  671.         _DisposeHandle:    OPWORD    $A023
  672.     ELSE
  673.         IMPORT_CFM_FUNCTION DisposeHandle
  674.     ENDIF
  675.  
  676. ;
  677. ; pascal void SetHandleSize(Handle h, Size newSize)
  678. ;
  679.     IF ¨ GENERATINGCFM THEN
  680.         ; parameters:
  681.         ;    h               => A0
  682.         ;    newSize         => D0
  683.         _SetHandleSize:    OPWORD    $A024
  684.     ELSE
  685.         IMPORT_CFM_FUNCTION SetHandleSize
  686.     ENDIF
  687.  
  688. ;
  689. ; pascal Size GetHandleSize(Handle h)
  690. ;
  691.     IF ¨ GENERATINGCFM THEN
  692.         _GetHandleSize:    OPWORD    $A025
  693.     ELSE
  694.         IMPORT_CFM_FUNCTION GetHandleSize
  695.     ENDIF
  696.  
  697. ;
  698. ; pascal Size InlineGetHandleSize(Handle h)
  699. ;
  700.     IF ¨ GENERATINGCFM THEN
  701.         ; parameters:
  702.         ;    h               => A0
  703.         ; returns:
  704.         ;    Size            <= D0
  705.         _InlineGetHandleSize:    OPWORD    $A025
  706.     ELSE
  707.         IMPORT_CFM_FUNCTION InlineGetHandleSize
  708.     ENDIF
  709.  
  710. ;
  711. ; pascal void ReallocateHandle(Handle h, Size byteCount)
  712. ;
  713.     IF ¨ GENERATINGCFM THEN
  714.         ; parameters:
  715.         ;    h               => A0
  716.         ;    byteCount       => D0
  717.         _ReallocateHandle:    OPWORD    $A027
  718.     ELSE
  719.         IMPORT_CFM_FUNCTION ReallocateHandle
  720.     ENDIF
  721.  
  722. ;
  723. ; pascal void ReallocateHandleSys(Handle h, Size byteCount)
  724. ;
  725.     IF ¨ GENERATINGCFM THEN
  726.         ; parameters:
  727.         ;    h               => A0
  728.         ;    byteCount       => D0
  729.         _ReallocateHandleSys:    OPWORD    $A427
  730.     ELSE
  731.         IMPORT_CFM_FUNCTION ReallocateHandleSys
  732.     ENDIF
  733.  
  734. ;
  735. ; pascal void EmptyHandle(Handle h)
  736. ;
  737.     IF ¨ GENERATINGCFM THEN
  738.         ; parameters:
  739.         ;    h               => A0
  740.         _EmptyHandle:    OPWORD    $A02B
  741.     ELSE
  742.         IMPORT_CFM_FUNCTION EmptyHandle
  743.     ENDIF
  744.  
  745. ;
  746. ; pascal void HSetRBit(Handle h)
  747. ;
  748.     IF ¨ GENERATINGCFM THEN
  749.         ; parameters:
  750.         ;    h               => A0
  751.         _HSetRBit:    OPWORD    $A067
  752.     ELSE
  753.         IMPORT_CFM_FUNCTION HSetRBit
  754.     ENDIF
  755.  
  756. ;
  757. ; pascal void HClrRBit(Handle h)
  758. ;
  759.     IF ¨ GENERATINGCFM THEN
  760.         ; parameters:
  761.         ;    h               => A0
  762.         _HClrRBit:    OPWORD    $A068
  763.     ELSE
  764.         IMPORT_CFM_FUNCTION HClrRBit
  765.     ENDIF
  766.  
  767. ;
  768. ; pascal SInt8 HGetState(Handle h)
  769. ;
  770.     IF ¨ GENERATINGCFM THEN
  771.         ; parameters:
  772.         ;    h               => A0
  773.         ; returns:
  774.         ;    SInt8           <= D0
  775.         _HGetState:    OPWORD    $A069
  776.     ELSE
  777.         IMPORT_CFM_FUNCTION HGetState
  778.     ENDIF
  779.  
  780. ;
  781. ; pascal void HSetState(Handle h, SInt8 flags)
  782. ;
  783.     IF ¨ GENERATINGCFM THEN
  784.         ; parameters:
  785.         ;    h               => A0
  786.         ;    flags           => D0
  787.         _HSetState:    OPWORD    $A06A
  788.     ELSE
  789.         IMPORT_CFM_FUNCTION HSetState
  790.     ENDIF
  791.  
  792. ;
  793. ; pascal void PurgeSpace(long *total, long *contig)
  794. ;
  795.     IF ¨ GENERATINGCFM THEN
  796.         _PurgeSpace:    OPWORD    $A162
  797.     ELSE
  798.         IMPORT_CFM_FUNCTION PurgeSpace
  799.     ENDIF
  800.  
  801.     ENDIF
  802.     IF FOR_SYSTEM7_ONLY THEN
  803. ;  These are defined in Kernel for System 8 
  804. ;
  805. ; pascal void BlockMove(const void *srcPtr, void *destPtr, Size byteCount)
  806. ;
  807.     IF ¨ GENERATINGCFM THEN
  808.         ; parameters:
  809.         ;    srcPtr          => A0
  810.         ;    destPtr         => A1
  811.         ;    byteCount       => D0
  812.         _BlockMove:    OPWORD    $A02E
  813.     ELSE
  814.         IMPORT_CFM_FUNCTION BlockMove
  815.     ENDIF
  816.  
  817. ;
  818. ; pascal void BlockMoveData(const void *srcPtr, void *destPtr, Size byteCount)
  819. ;
  820.     IF ¨ GENERATINGCFM THEN
  821.         ; parameters:
  822.         ;    srcPtr          => A0
  823.         ;    destPtr         => A1
  824.         ;    byteCount       => D0
  825.         _BlockMoveData:    OPWORD    $A22E
  826.     ELSE
  827.         IMPORT_CFM_FUNCTION BlockMoveData
  828.     ENDIF
  829.  
  830. ;
  831. ; extern void BlockMoveUncached(const void *srcPtr, void *destPtr, Size byteCount)
  832. ;
  833.     IF GENERATINGCFM THEN
  834.         IMPORT_CFM_FUNCTION BlockMoveUncached
  835.     ENDIF
  836.  
  837. ;
  838. ; extern void BlockMoveDataUncached(const void *srcPtr, void *destPtr, Size byteCount)
  839. ;
  840.     IF GENERATINGCFM THEN
  841.         IMPORT_CFM_FUNCTION BlockMoveDataUncached
  842.     ENDIF
  843.  
  844. ;
  845. ; extern void BlockZero(void *destPtr, Size byteCount)
  846. ;
  847.     IF GENERATINGCFM THEN
  848.         IMPORT_CFM_FUNCTION BlockZero
  849.     ENDIF
  850.  
  851. ;
  852. ; extern void BlockZeroUncached(void *destPtr, Size byteCount)
  853. ;
  854.     IF GENERATINGCFM THEN
  855.         IMPORT_CFM_FUNCTION BlockZeroUncached
  856.     ENDIF
  857.  
  858.     ENDIF
  859.     IF FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED THEN
  860. ;
  861. ; pascal void MaxApplZone(void )
  862. ;
  863.     IF ¨ GENERATINGCFM THEN
  864.         _MaxApplZone:    OPWORD    $A063
  865.     ELSE
  866.         IMPORT_CFM_FUNCTION MaxApplZone
  867.     ENDIF
  868.  
  869. ;
  870. ; pascal void SetApplBase(void *startPtr)
  871. ;
  872.     IF ¨ GENERATINGCFM THEN
  873.         ; parameters:
  874.         ;    startPtr        => A0
  875.         _SetApplBase:    OPWORD    $A057
  876.     ELSE
  877.         IMPORT_CFM_FUNCTION SetApplBase
  878.     ENDIF
  879.  
  880. ;
  881. ; pascal void MoreMasters(void )
  882. ;
  883.     IF ¨ GENERATINGCFM THEN
  884.         _MoreMasters:    OPWORD    $A036
  885.     ELSE
  886.         IMPORT_CFM_FUNCTION MoreMasters
  887.     ENDIF
  888.  
  889. ;
  890. ; pascal void SetApplLimit(void *zoneLimit)
  891. ;
  892.     IF ¨ GENERATINGCFM THEN
  893.         ; parameters:
  894.         ;    zoneLimit       => A0
  895.         _SetApplLimit:    OPWORD    $A02D
  896.     ELSE
  897.         IMPORT_CFM_FUNCTION SetApplLimit
  898.     ENDIF
  899.  
  900.     ENDIF
  901.     IF FOR_SYSTEM7_ONLY THEN
  902. ;
  903. ; pascal void InitApplZone(void )
  904. ;
  905.     IF ¨ GENERATINGCFM THEN
  906.         _InitApplZone:    OPWORD    $A02C
  907.     ELSE
  908.         IMPORT_CFM_FUNCTION InitApplZone
  909.     ENDIF
  910.  
  911.     ENDIF
  912.     IF FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED THEN
  913. ;   Temporary Memory routines renamed, but obsolete, in System 7.0 and later.  
  914. ;
  915. ; pascal void TempHLock(Handle h, OSErr *resultCode)
  916. ;
  917.     IF ¨ GENERATINGCFM THEN
  918.         Macro
  919.         _TempHLock
  920.             move.w              #$001E,-(sp)
  921.             dc.w                $A88F
  922.         EndM
  923.     ELSE
  924.         IMPORT_CFM_FUNCTION TempHLock
  925.     ENDIF
  926.  
  927. ;
  928. ; pascal void TempHUnlock(Handle h, OSErr *resultCode)
  929. ;
  930.     IF ¨ GENERATINGCFM THEN
  931.         Macro
  932.         _TempHUnlock
  933.             move.w              #$001F,-(sp)
  934.             dc.w                $A88F
  935.         EndM
  936.     ELSE
  937.         IMPORT_CFM_FUNCTION TempHUnlock
  938.     ENDIF
  939.  
  940. ;
  941. ; pascal void TempDisposeHandle(Handle h, OSErr *resultCode)
  942. ;
  943.     IF ¨ GENERATINGCFM THEN
  944.         Macro
  945.         _TempDisposeHandle
  946.             move.w              #$0020,-(sp)
  947.             dc.w                $A88F
  948.         EndM
  949.     ELSE
  950.         IMPORT_CFM_FUNCTION TempDisposeHandle
  951.     ENDIF
  952.  
  953. ;
  954. ; pascal Ptr TempTopMem(void )
  955. ;
  956.     IF ¨ GENERATINGCFM THEN
  957.         Macro
  958.         _TempTopMem
  959.             move.w              #$0016,-(sp)
  960.             dc.w                $A88F
  961.         EndM
  962.     ELSE
  963.         IMPORT_CFM_FUNCTION TempTopMem
  964.     ENDIF
  965.  
  966.     ENDIF
  967.     IF FOR_SYSTEM7_ONLY THEN
  968. ;
  969. ; pascal OSErr HoldMemory(void *address, unsigned long count)
  970. ;
  971.     IF ¨ GENERATINGCFM THEN
  972.         ; parameters:
  973.         ;    address         => A0
  974.         ;    count           => A1
  975.         ; returns:
  976.         ;    OSErr           <= D0
  977.         Macro
  978.         _HoldMemory
  979.             moveq               #0,D0
  980.             dc.w                $A05C
  981.         EndM
  982.     ELSE
  983.         IMPORT_CFM_FUNCTION HoldMemory
  984.     ENDIF
  985.  
  986. ;
  987. ; pascal OSErr UnholdMemory(void *address, unsigned long count)
  988. ;
  989.     IF ¨ GENERATINGCFM THEN
  990.         ; parameters:
  991.         ;    address         => A0
  992.         ;    count           => A1
  993.         ; returns:
  994.         ;    OSErr           <= D0
  995.         Macro
  996.         _UnholdMemory
  997.             moveq               #1,D0
  998.             dc.w                $A05C
  999.         EndM
  1000.     ELSE
  1001.         IMPORT_CFM_FUNCTION UnholdMemory
  1002.     ENDIF
  1003.  
  1004. ;
  1005. ; pascal OSErr LockMemory(void *address, unsigned long count)
  1006. ;
  1007.     IF ¨ GENERATINGCFM THEN
  1008.         ; parameters:
  1009.         ;    address         => A0
  1010.         ;    count           => A1
  1011.         ; returns:
  1012.         ;    OSErr           <= D0
  1013.         Macro
  1014.         _LockMemory
  1015.             moveq               #2,D0
  1016.             dc.w                $A05C
  1017.         EndM
  1018.     ELSE
  1019.         IMPORT_CFM_FUNCTION LockMemory
  1020.     ENDIF
  1021.  
  1022. ;
  1023. ; pascal OSErr LockMemoryContiguous(void *address, unsigned long count)
  1024. ;
  1025.     IF ¨ GENERATINGCFM THEN
  1026.         ; parameters:
  1027.         ;    address         => A0
  1028.         ;    count           => A1
  1029.         ; returns:
  1030.         ;    OSErr           <= D0
  1031.         Macro
  1032.         _LockMemoryContiguous
  1033.             moveq               #4,D0
  1034.             dc.w                $A05C
  1035.         EndM
  1036.     ELSE
  1037.         IMPORT_CFM_FUNCTION LockMemoryContiguous
  1038.     ENDIF
  1039.  
  1040. ;
  1041. ; pascal OSErr UnlockMemory(void *address, unsigned long count)
  1042. ;
  1043.     IF ¨ GENERATINGCFM THEN
  1044.         ; parameters:
  1045.         ;    address         => A0
  1046.         ;    count           => A1
  1047.         ; returns:
  1048.         ;    OSErr           <= D0
  1049.         Macro
  1050.         _UnlockMemory
  1051.             moveq               #3,D0
  1052.             dc.w                $A05C
  1053.         EndM
  1054.     ELSE
  1055.         IMPORT_CFM_FUNCTION UnlockMemory
  1056.     ENDIF
  1057.  
  1058. ;
  1059. ; pascal OSErr GetPhysical(LogicalToPhysicalTable *addresses, unsigned long *physicalEntryCount)
  1060. ;
  1061.     IF ¨ GENERATINGCFM THEN
  1062.         Macro
  1063.         _GetPhysical
  1064.             moveq               #5,D0
  1065.             dc.w                $A05C
  1066.         EndM
  1067.     ELSE
  1068.         IMPORT_CFM_FUNCTION GetPhysical
  1069.     ENDIF
  1070.  
  1071. ;
  1072. ; pascal OSErr DeferUserFn(UserFnUPP userFunction, void *argument)
  1073. ;
  1074.     IF ¨ GENERATINGCFM THEN
  1075.         ; parameters:
  1076.         ;    userFunctionargument=> A0
  1077.         ;    argument        => D0
  1078.         ; returns:
  1079.         ;    OSErr           <= D0
  1080.         _DeferUserFn:    OPWORD    $A08F
  1081.     ELSE
  1082.         IMPORT_CFM_FUNCTION DeferUserFn
  1083.     ENDIF
  1084.  
  1085. ;
  1086. ; pascal long DebuggerGetMax(void )
  1087. ;
  1088.     IF ¨ GENERATINGCFM THEN
  1089.         ; returns:
  1090.         ;    long            <= D0
  1091.         Macro
  1092.         _DebuggerGetMax
  1093.             moveq               #0,D0
  1094.             dc.w                $A08D
  1095.         EndM
  1096.     ELSE
  1097.         IMPORT_CFM_FUNCTION DebuggerGetMax
  1098.     ENDIF
  1099.  
  1100. ;
  1101. ; pascal void DebuggerEnter(void )
  1102. ;
  1103.     IF ¨ GENERATINGCFM THEN
  1104.         Macro
  1105.         _DebuggerEnter
  1106.             moveq               #1,D0
  1107.             dc.w                $A08D
  1108.         EndM
  1109.     ELSE
  1110.         IMPORT_CFM_FUNCTION DebuggerEnter
  1111.     ENDIF
  1112.  
  1113. ;
  1114. ; pascal void DebuggerExit(void )
  1115. ;
  1116.     IF ¨ GENERATINGCFM THEN
  1117.         Macro
  1118.         _DebuggerExit
  1119.             moveq               #2,D0
  1120.             dc.w                $A08D
  1121.         EndM
  1122.     ELSE
  1123.         IMPORT_CFM_FUNCTION DebuggerExit
  1124.     ENDIF
  1125.  
  1126. ;
  1127. ; pascal void DebuggerPoll(void )
  1128. ;
  1129.     IF ¨ GENERATINGCFM THEN
  1130.         Macro
  1131.         _DebuggerPoll
  1132.             moveq               #3,D0
  1133.             dc.w                $A08D
  1134.         EndM
  1135.     ELSE
  1136.         IMPORT_CFM_FUNCTION DebuggerPoll
  1137.     ENDIF
  1138.  
  1139. ;
  1140. ; pascal PageState GetPageState(const void *address)
  1141. ;
  1142.     IF ¨ GENERATINGCFM THEN
  1143.         ; parameters:
  1144.         ;    address         => A0
  1145.         ; returns:
  1146.         ;    PageState       <= D0
  1147.         Macro
  1148.         _GetPageState
  1149.             moveq               #4,D0
  1150.             dc.w                $A08D
  1151.         EndM
  1152.     ELSE
  1153.         IMPORT_CFM_FUNCTION GetPageState
  1154.     ENDIF
  1155.  
  1156. ;
  1157. ; pascal Boolean PageFaultFatal(void )
  1158. ;
  1159.     IF ¨ GENERATINGCFM THEN
  1160.         ; returns:
  1161.         ;    Boolean         <= D0
  1162.         Macro
  1163.         _PageFaultFatal
  1164.             moveq               #5,D0
  1165.             dc.w                $A08D
  1166.         EndM
  1167.     ELSE
  1168.         IMPORT_CFM_FUNCTION PageFaultFatal
  1169.     ENDIF
  1170.  
  1171. ;
  1172. ; pascal OSErr DebuggerLockMemory(void *address, unsigned long count)
  1173. ;
  1174.     IF ¨ GENERATINGCFM THEN
  1175.         ; parameters:
  1176.         ;    address         => A0
  1177.         ;    count           => A1
  1178.         ; returns:
  1179.         ;    OSErr           <= D0
  1180.         Macro
  1181.         _DebuggerLockMemory
  1182.             moveq               #6,D0
  1183.             dc.w                $A08D
  1184.         EndM
  1185.     ELSE
  1186.         IMPORT_CFM_FUNCTION DebuggerLockMemory
  1187.     ENDIF
  1188.  
  1189. ;
  1190. ; pascal OSErr DebuggerUnlockMemory(void *address, unsigned long count)
  1191. ;
  1192.     IF ¨ GENERATINGCFM THEN
  1193.         ; parameters:
  1194.         ;    address         => A0
  1195.         ;    count           => A1
  1196.         ; returns:
  1197.         ;    OSErr           <= D0
  1198.         Macro
  1199.         _DebuggerUnlockMemory
  1200.             moveq               #7,D0
  1201.             dc.w                $A08D
  1202.         EndM
  1203.     ELSE
  1204.         IMPORT_CFM_FUNCTION DebuggerUnlockMemory
  1205.     ENDIF
  1206.  
  1207. ;
  1208. ; pascal StatusRegisterContents EnterSupervisorMode(void )
  1209. ;
  1210.     IF ¨ GENERATINGCFM THEN
  1211.         ; returns:
  1212.         ;    StatusRegisterContents <= D0
  1213.         Macro
  1214.         _EnterSupervisorMode
  1215.             moveq               #8,D0
  1216.             dc.w                $A08D
  1217.         EndM
  1218.     ELSE
  1219.         IMPORT_CFM_FUNCTION EnterSupervisorMode
  1220.     ENDIF
  1221.  
  1222.     ENDIF
  1223. ;
  1224. ; StripAddress and Translate24To32 macro to nothing on PowerPC
  1225. ;   StripAddress is implemented as a trap in System 6 or later 
  1226. ;
  1227. ;
  1228. ; pascal Ptr StripAddress(void *theAddress)
  1229. ;
  1230.     IF ¨ GENERATINGCFM THEN
  1231.         ; parameters:
  1232.         ;    theAddress      => D0
  1233.         ; returns:
  1234.         ;    Ptr             <= D0
  1235.         _StripAddress:    OPWORD    $A055
  1236.     ELSE
  1237.         IMPORT_CFM_FUNCTION StripAddress
  1238.     ENDIF
  1239.  
  1240. ;
  1241. ; pascal Ptr Translate24To32(void *addr24)
  1242. ;
  1243.     IF ¨ GENERATINGCFM THEN
  1244.         ; parameters:
  1245.         ;    addr24          => D0
  1246.         ; returns:
  1247.         ;    Ptr             <= D0
  1248.         _Translate24To32:    OPWORD    $A091
  1249.     ELSE
  1250.         IMPORT_CFM_FUNCTION Translate24To32
  1251.     ENDIF
  1252.  
  1253.     IF FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE THEN
  1254. ;
  1255. ; pascal OSErr HandToHand(Handle *theHndl)
  1256. ;
  1257.     IF ¨ GENERATINGCFM THEN
  1258.         _HandToHand:    OPWORD    $A9E1
  1259.     ELSE
  1260.         IMPORT_CFM_FUNCTION HandToHand
  1261.     ENDIF
  1262.  
  1263. ;
  1264. ; pascal OSErr PtrToXHand(const void *srcPtr, Handle dstHndl, long size)
  1265. ;
  1266.     IF ¨ GENERATINGCFM THEN
  1267.         ; parameters:
  1268.         ;    srcPtr          => A0
  1269.         ;    dstHndl         => A1
  1270.         ;    size            => D0
  1271.         ; returns:
  1272.         ;    OSErr           <= D0
  1273.         _PtrToXHand:    OPWORD    $A9E2
  1274.     ELSE
  1275.         IMPORT_CFM_FUNCTION PtrToXHand
  1276.     ENDIF
  1277.  
  1278. ;
  1279. ; pascal OSErr PtrToHand(const void *srcPtr, Handle *dstHndl, long size)
  1280. ;
  1281.     IF ¨ GENERATINGCFM THEN
  1282.         _PtrToHand:    OPWORD    $A9E3
  1283.     ELSE
  1284.         IMPORT_CFM_FUNCTION PtrToHand
  1285.     ENDIF
  1286.  
  1287. ;
  1288. ; pascal OSErr HandAndHand(Handle hand1, Handle hand2)
  1289. ;
  1290.     IF ¨ GENERATINGCFM THEN
  1291.         ; parameters:
  1292.         ;    hand1           => A0
  1293.         ;    hand2           => A1
  1294.         ; returns:
  1295.         ;    OSErr           <= D0
  1296.         _HandAndHand:    OPWORD    $A9E4
  1297.     ELSE
  1298.         IMPORT_CFM_FUNCTION HandAndHand
  1299.     ENDIF
  1300.  
  1301. ;
  1302. ; pascal OSErr PtrAndHand(const void *ptr1, Handle hand2, long size)
  1303. ;
  1304.     IF ¨ GENERATINGCFM THEN
  1305.         ; parameters:
  1306.         ;    ptr1            => A0
  1307.         ;    hand2           => A1
  1308.         ;    size            => D0
  1309.         ; returns:
  1310.         ;    OSErr           <= D0
  1311.         _PtrAndHand:    OPWORD    $A9EF
  1312.     ELSE
  1313.         IMPORT_CFM_FUNCTION PtrAndHand
  1314.     ENDIF
  1315.  
  1316.     ENDIF
  1317.     IF OLDROUTINENAMES THEN
  1318.     IF FOR_SYSTEM7_ONLY THEN
  1319.     ENDIF
  1320.     IF FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE THEN
  1321.     ENDIF
  1322.     ENDIF
  1323.     ENDIF ; __MEMORY__ 
  1324.  
  1325.